﻿@{
    ViewBag.Title = "PutRecord";
    Layout = "~/Views/Shared/Template.cshtml";
}
<link href="~/static/collect.css" rel="stylesheet" />
<link href="~/static/myhome.css" rel="stylesheet" />

@using Partner.MVC.Models;
@{
    var user = Session["LoginUser"] as User_Info;
}

<div style="height: 300px;width: 100%;background:url(/static/hbweb/images/me.jpg);">
    <div class="container">
        <div class="header-message">
            <img class="fl" src="http://pic.huobanchina.com/o_1bp7omfg8e821pc4bbg1u8g1ifl9.jpeg" alt="" />
            <div class="fl header-text">
                <h3 class="user-name">@user.Use_Name </h3>
                <i class="icon-fabu3 point user-namei"></i>
            </div>
            <a id="AlterPwd" style="width:85px;" data-toggle="modal" data-target="#myModal" class="fr fn-font-hover-blue change change-password">
                修改密码
            </a>
        </div>
    </div>
</div>

<div class="bgcSil">
    <div class="container">
        <div class="mt30" style="width: 100%">
            <ul id="divLeft" style="width:24%" class="nav navbar-nav"></ul>
            <div id="divContent" style="width:75%;" class="fr mb80 cont bgcWhit news-list-con">
                <div class="news-list-con fn-mb140 bgcWhit">
                    <div class="news-list-info" id="houseBox">
                        <div onclick="delall()" style="margin-left:90%" class="dleact">
                            <i class="icon-delect"></i>
                            批量删除
                        </div>
                        <ul id='messageBox'>
                            @foreach (var a in Model)
                            {
                                <li hoseid="adbedfc63077473997f9dfc9e23ea6e6" class="fcBlack pr">
                                    <a class="fl" href="/f/information?id=adbedfc63077473997f9dfc9e23ea6e6" target="_blank">
                                        <img src="http://47.93.33.136:8080/userfiles/1/images/adminReleaseRoom/img/2017/08/fangjian.jpg" alt="@a.House_Name - @a.House_Telphone" />
                                    </a>
                                    <input type="checkbox" style="width:20px; height:20px;" name="checked" class="chckb" value="@a.House_Id" />
                                    <div class="news-note">
                                        <div class="fl">
                                            <h3>
                                                <a class="fcBlack" href="/HouseMessage/HouseMessage?House_Id=@a.House_Id" target="_blank" title="@a.House_Name - @a.House_Telphone">@a.House_Name - @a.House_Telphone</a>
                                            </h3>
                                            <p class="p"><span>面积</span>&nbsp;&nbsp;&nbsp;<span>@a.House_Area m<sup>2</sup> | @a.House_Decorate</span></p>
                                            <p>地址 ： @a.House_Address</p>
                                            <br />
                                        </div>
                                        <div class=" fr">
                                            <p>租<span style="color: red;font-size: 30px">@a.House_Price</span><img src="file:///C:\Users\lilili\AppData\Local\Temp\SGPicFaceTpBq\8376\0AE5B7E8.png" />千元/月</p>
                                        </div>
                                    </div>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 绑定左侧导航 -->
<script>
    ParentNav();
    // 绑定根节点
    function ParentNav() {
        $.ajax({
            type: "post",
            url: "/Partner/LeftNav",
            dataType: "json",
            success: function (data) {
                var htmltab = "";
                for (var i = 0; i < data.length; i++) {
                    htmltab += "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" style=\"width: 175px;font-size: 16px;\">" + data[i].Lar_Name + "</a>" + SonNav(data[i].Limit_Id) + "</li>";
                }
                $("#divLeft").append(htmltab);
            },
            error: function (err) {
                alert(err);
            }
        })
    }
    // 绑定子节点
    function SonNav(id) {
        var html1 = "";
        $.ajax({
            type: "post",
            url: "/Partner/LeftSon",
            data: { pid: id },
            dataType: "json",
            async: false,
            success: function (data) {
                var strhtml = "<ul class=\"dropdown-menu\">"
                for (var i = 0; i < data.length; i++) {
                    strhtml += "<li><a href=\"" + data[i].Limit_Url + "\">" + data[i].Limit_Name + "</a></li>"
                }
                strhtml += "</ul>";
                html1 = strhtml;
            }
        })
        return html1;
    }

    //批量删除
    function delall() {
        var ck = $(":checkbox:checked")
        var id = "";
        //选数据，获取选中行的 id ，循环 ，拼接  1,2,3 多条数据
        for (var i = 0; i < ck.length; i++) {
            id += ck[i].value + ",";
        }
        alert(id)
        id = id.substr(0, id.length - 1);

        if (confirm('确定要删除吗？')) {
            $.ajax({
                type: "post",
                url: "/UserCenter/ThrowRecord",
                data: { House_Id: id },
                success: function (obj) {
                    if (obj > 0) {
                        alert('删除成功');
                        location.href = '/usercenter/PutRecord'
                    }
                    else {
                        alert('删除失败')
                    }
                }
            })
        }

    }
</script>
